package top.healthylife.gateway.platform.lexin.dto.heibaiinfo.res;

import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Arrays;
import java.util.List;

/**
 * @author : GaoZeXi
 * @date 2021/11/2 17:53
 */
@Data
@Accessors(chain = true)
@ApiModel("黑白用户分")
public class HeiBaiInfo {
    @ApiModelProperty(value = "关系圈平均涉黑等级", notes = "等级 [10,20,30,40,50] 根据关系网络内各涉黑行为和用户人数评估平均涉黑程度")
    private String socialNetAvgHeiLev;
    @ApiModelProperty(value = "关系圈正常用户等级", notes = "等级 [10,20,30,40,50] 根据关系网络内健康用户的人数评估关系圈正常用户等级")
    private String socialNetNormLev;
    @ApiModelProperty(value = "关系圈正常用户活跃等级", notes = "等级 [10,20,30,40,50] 根据关系网络内健康用户的活跃程度评估关系圈正常用户活跃等级")
    private String socialNetNormActLev;
    @ApiModelProperty(value = "黑白风险等级", notes = "等级 [10,20,30,40,50,60,70] 基于关联数据和关系圈数据评估涉黑风险的等级")
    private String heibaiScoreLev;
    @ApiModelProperty(value = "关系圈涉黑用户等级", notes = "等级 [10,20,30,40,50] 根据关系网络内涉黑用户的人数评估关系圈涉黑用户等级")
    private String socialNetHeiLev;
    @ApiModelProperty(value = "关系圈涉黑用户活跃等级", notes = "等级 [10,20,30,40,50] 根据关系网络内涉黑用户的活跃程度评估关系圈涉黑用户活跃等级")
    private String socialNetHeiActLev;
    @ApiModelProperty(value = "关系圈平均涉黑等级-反解析京东分", notes = "")
    private String jdModuleAvgHeiScore;
    @ApiModelProperty(value = "关系圈正常用户等级-反解析京东分", notes = "")
    private String jdModulePinCntRateW;
    @ApiModelProperty(value = "关系圈正常用户活跃等级-反解析京东分", notes = "")
    private String jdModuleWhitepinBrowseRateW;
    @ApiModelProperty(value = "黑白风险等级-反解析京东分", notes = "")
    private String jdModuleRiskLevel;
    @ApiModelProperty(value = "关系圈涉黑用户等级-反解析京东分", notes = "")
    private String jdModulePinCntRate;
    @ApiModelProperty(value = "关系圈涉黑用户活跃等级-反解析京东分", notes = "")
    private String jdModuleHeipinBrowseRate;

//    public static void main(String[] args) {
//        HeiBaiInfo heiBaiInfo = new HeiBaiInfo();
//        heiBaiInfo.setHeibaiScoreLev("20")
//                .setSocialNetAvgHeiLev("50")
//                .setSocialNetHeiActLev("20")
//                .setSocialNetHeiLev("30")
//                .setSocialNetNormActLev("10")
//                .setSocialNetNormLev("10");
//        System.out.println("jdModuleAvgHeiScore:"+heiBaiInfo.getJdModuleAvgHeiScore());
//        System.out.println("jdModulePinCntRateW:"+heiBaiInfo.getJdModulePinCntRateW());
//        System.out.println("jdModuleWhitepinBrowseRateW:"+heiBaiInfo.getJdModuleWhitepinBrowseRateW());
//        System.out.println("jdModuleRiskLevel:"+heiBaiInfo.getJdModuleRiskLevel());
//        System.out.println("jdModulePinCntRate:"+heiBaiInfo.getJdModulePinCntRate());
//        System.out.println("jdModuleHeipinBrowseRate:"+heiBaiInfo.getJdModuleHeipinBrowseRate());
//    }

    /**
     * 反解析京东分-关系圈平均涉黑等级
     * @return 京东分
     */
    public String getJdModuleAvgHeiScore() {
        List<Float> level = Arrays.asList(10F, 20F, 30F, 40F, 50F);
        float v;
        try {
            v = Float.parseFloat(this.socialNetAvgHeiLev);

        } catch (Exception e) {
            return "-1";
        }
        if(v<0|| ObjectUtil.isNull(v)){
            return "-1";
        }else if(level.contains(v)){
            return String.valueOf(v/10);
        }else {
            return "-1";
        }
    }

    /**
     * 反解析京东分-关系圈正常用户等级
     * @return 京东分
     */
    public String getJdModulePinCntRateW() {
        List<Float> level = Arrays.asList(10F, 20F, 30F, 40F, 50F);
        float v;
        try {
            v = Float.parseFloat(this.socialNetNormLev);

        } catch (Exception e) {
            return "-1";
        }
        if(v<0|| ObjectUtil.isNull(v)){
            return "-1";
        }else if(level.contains(v)){
            return String.valueOf(v/10);
        }else {
            return "-1";
        }
    }

    /**
     * 反解析京东分-关系圈正常用户活跃等级
     * @return 京东分
     */
    public String getJdModuleWhitepinBrowseRateW() {
        List<Float> level = Arrays.asList(10F, 20F, 30F, 40F, 50F);
        float v;
        try {
            v = Float.parseFloat(this.socialNetNormActLev);

        } catch (Exception e) {
            return "-1";
        }
        if(v<0|| ObjectUtil.isNull(v)){
            return "-1";
        }else if(level.contains(v)){
            return String.valueOf(v/10);
        }else {
            return "-1";
        }
    }

    /**
     * 反解析京东分-黑白风险等级
     * @return 京东分
     */
    public String getJdModuleRiskLevel() {
        List<Float> level = Arrays.asList(10F, 20F, 30F, 40F, 50F,60F,70F);
        float v;
        try {
            v = Float.parseFloat(this.heibaiScoreLev);

        } catch (Exception e) {
            return "-1";
        }
        if(v<0|| ObjectUtil.isNull(v)){
            return "-1";
        }else if(level.contains(v)){
            return String.valueOf(v/10);
        }else {
            return "-1";
        }
    }

    /**
     * 反解析京东分-关系圈涉黑用户等级
     * @return 京东分
     */
    public String getJdModulePinCntRate() {
        List<Float> level = Arrays.asList(10F, 20F, 30F, 40F, 50F);
        float v;
        try {
            v = Float.parseFloat(this.socialNetHeiLev);

        } catch (Exception e) {
            return "-1";
        }
        if(v<0|| ObjectUtil.isNull(v)){
            return "-1";
        }else if(level.contains(v)){
            return String.valueOf(v/10);
        }else {
            return "-1";
        }
    }

    /**
     * 反解析京东分-关系圈涉黑用户活跃等级
     * @return 京东分
     */
    public String getJdModuleHeipinBrowseRate() {
        List<Float> level = Arrays.asList(10F, 20F, 30F, 40F, 50F);
        float v;
        try {
            v = Float.parseFloat(this.socialNetHeiActLev);

        } catch (Exception e) {
            return "-1";
        }
        if(v<0|| ObjectUtil.isNull(v)){
            return "-1";
        }else if(level.contains(v)){
            return String.valueOf(v/10);
        }else {
            return "-1";
        }
    }
}
